<?php

/* @var $this yii\web\View */
$this->registerJsFile('/js/Chart.js', ['depends' => [\yii\web\JqueryAsset::className()]]);

$this->title = '控制面板';
?>
    <div class="site-index">

        <div class="alert alert-info" role="alert">
            欢迎使用<b>小冰动力</b>新一站式管理后台
            <a href="http://www.xbdla.com" target="_blank" class="alert-link">联系我们</a>
        </div>

        <div class="body-content">

            <div class="row">
                <div class="col-lg-6">
                    <div class="panel panel-primary">
                        <div class="panel-heading">
                            <h3 class="panel-title">后台公告</h3>
                        </div>
                        <div class="panel-body" style="height: 178px">

                        </div>
                    </div>
                </div>
                <div class="col-lg-6">
                    <div class="panel panel-danger">
                        <div class="panel-heading">
                            <h3 class="panel-title">当前统计</h3>
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-4">
                                    <div class="small-box bg-green">
                                        <div class="inner">
                                            <h3>0<sup style="font-size: 20px">篇</sup></h3>
                                            <p>当前内容(文章)</p>
                                        </div>
                                        <div class="icon">
                                            <i class="fa fa-book"></i>
                                        </div>
                                        <a href="#" class="small-box-footer">更多信息 <i
                                                class="fa fa-arrow-circle-right"></i></a>
                                    </div>
                                </div>
                                <div class="col-lg-4">
                                    <div class="small-box bg-red">
                                        <div class="inner">
                                            <h3>0<sup style="font-size: 20px">篇</sup></h3>
                                            <p>待审内容(文章)</p>
                                        </div>
                                        <div class="icon">
                                            <i class="fa fa-book"></i>
                                        </div>
                                        <a href="#" class="small-box-footer">更多信息 <i
                                                class="fa fa-arrow-circle-right"></i></a>
                                    </div>
                                </div>
                                <div class="col-lg-4">
                                    <div class="small-box bg-yellow">
                                        <div class="inner">
                                            <h3>0<sup style="font-size: 20px">人</sup></h3>
                                            <p>当前注册用户</p>
                                        </div>
                                        <div class="icon">
                                            <i class="fa fa-user"></i>
                                        </div>
                                        <a href="#" class="small-box-footer">更多信息 <i
                                                class="fa fa-arrow-circle-right"></i></a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">常用功能</h3>
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-2">
                                    <a class="btn btn-primary btn-lg btn-block" href="#" role="button">发布文章</a>
                                </div>
                                <div class="col-lg-2">
                                    <a class="btn btn-success btn-lg btn-block" href="#" role="button">新建素材</a>
                                </div>
                                <div class="col-lg-2">
                                    <a class="btn btn-info btn-lg btn-block" href="#" role="button">新建栏目</a>
                                </div>
                                <div class="col-lg-2">
                                    <a class="btn btn-warning btn-lg btn-block" href="#" role="button">添加幻灯片</a>
                                </div>
                                <div class="col-lg-2">
                                    <a class="btn btn-danger btn-lg btn-block" href="#" role="button">查看留言</a>
                                </div>
                                <div class="col-lg-2">
                                    <a class="btn btn-default btn-lg btn-block" href="#" role="button">站点设置</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">站点统计</h3>
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-6">
                                    <h3 class="text-center">7天前访问量</h3>
                                    <canvas id="myChart" height="400"></canvas>
                                </div>
                                <div class="col-lg-6">
                                    <h3 class="text-center">7天前用户量</h3>
                                    <canvas id="myChart2" height="400"></canvas>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
<?php $this->beginBlock('js'); ?>
    <script type="text/javascript">
        $("#myChart,#myChart2").attr("width", $("#myChart").parent().width());
        var data = {
            labels: <?=$pvList['labels']?>,
            datasets: [
                {
                    fillColor: "rgba(220,220,220,0.5)", //背景填充色
                    strokeColor: "rgba(4,155,252,1)", //路径颜色
                    pointColor: "rgba(53,214,254,1)", //数据点颜色
                    pointStrokeColor: "#fff", //数据点边框颜色
                    data: <?=$pvList['data']?> //对象数据
                }
            ]
        };
        var options = {
            bezierCurve: false
        };
        var ctx = $("#myChart").get(0).getContext("2d");
        var myNewChart = new Chart(ctx).Line(data, options);
        //
        var data2 = {
            labels: <?=$uvList['labels']?>,
            datasets: [
                {
                    fillColor: "rgba(220,220,220,0.5)", //背景填充色
                    strokeColor: "rgba(243,156,18,1)", //路径颜色
                    pointColor: "rgba(248,180,83,1)", //数据点颜色
                    pointStrokeColor: "#fff", //数据点边框颜色
                    data: <?=$uvList['data']?> //对象数据
                }
            ]
        };
        var options2 = {
            bezierCurve: false
        };
        var ctx2 = $("#myChart2").get(0).getContext("2d");
        var myNewChart2 = new Chart(ctx2).Line(data2, options2);
    </script>
<?php $this->endBlock('js'); ?>